<style>
.content-group {background:#fff;border-radius: 0.5rem;margin-bottom:0.39rem}
.carousel {margin-top:0}
</style>
<div ng-include="sys_html('common/_header','','','jy_weishop')"></div>
<div class="fui-page fui-page-current page-goods-list">
<div class='fui-content' style="top:0">
	<div class="topbg" style="position: relative;text-align:center;width:100%;height:4.5rem;background: url({{tomedia(pagedata.pluginset.topbg) || '../addons/jy_pigtuan/resource/images/topbg.jpg'}}) no-repeat 50%;background-size: cover;">
		<div style="padding-top:1.5rem"><img style="width:5rem" ng-src="{{tomedia(pagedata.pluginset.logo) || '../addons/jy_pigtuan/resource/images/logo.png'}}"/></div>
		<div style="padding-top:0"><img style="width:8rem" ng-src="{{tomedia(pagedata.pluginset.logodesc) || '../addons/jy_pigtuan/resource/images/logodesc.png'}}"/></div>
		<i onclick="$('#showsharecover').modal();" class="icon icon-fenxiang1" style="position:absolute;right:0.8rem;top:2.5rem;font-size:1rem;color:#fff"></i>
	</div>
	<div style="padding:0.3rem 0.5rem">
		<div class="content-group">
		<div class="fui-list-group merchgroup" style="margin-top:0">
				<div class="fui-list jump">
					<div class="fui-list-media">
						<img class="round" style="border-radius: 50%;" ng-src="{{tomedia(pagedata.pluginset.storelogo) || '../addons/jy_pigtuan/resource/images/storelogo.jpg'}}">
					</div>
					<div class="fui-list-inner" style="border-right: 2px solid #efefef;">
						<div class="title">{{pagedata.store.title}}{{pagedata.pluginset.title || '兴盛优选'}}</div>
						<div class="subtitle">{{pagedata.pluginset.desc || '兴盛你我他，优选人人夸'}}</div>
					</div>
				   <div class="fui-list-media" style="width:6rem;text-align:center;padding-left:0.3rem;margin-right:0">
						<div class="fui-list-inner">
							<div class="num bold" style="font-size:0.8rem;color:#31bdbc">{{pagedata.store.members}}</div>
							<div class="subtitle">粉丝数</div>
					   </div>
					   <div class="fui-list-inner">
							<div class="num bold" style="font-size:0.8rem;color:#da7b5f">{{pagedata.store.salenum}}</div>
							<div class="subtitle">购买指数</div>
					   </div>
				   </div>
				</div>   
		</div>
		</div>
		<div class="content-group">
			<div class="fui-searchbar bar" style="z-index: 0;">
				<div ng-class="{'searchbar':1,'searchbar-active':pagedata.searchbar ==1}" style="background:#fff">
						<div style="position: relative;left:0;top:0;">
							<div class="search-input" style="">
								<i id="searchsub" class="icon icon-sousuo1"  ng-click="tool.get_list('jy_weishop/goods.index/getlist/',true)"></i>
								<input type="search" placeholder="搜索商品" class="search" ng-model="pagedata.params.keyword" style="text-align: left; color: #999; font-size:0.6rem;background:#f9f9f9;border-radius: 1rem;" />
							</div>
						</div>
				</div>
			</div>
		</div>
		<div ng-if="pagedata.setting.hdps.length>0" ng-include="sys_html('shop/_hdps','','','jy_weishop')" class="radius" style="padding-bottom:0.3rem"></div>
		<div ng-include="sys_html('shop/_goods_you','','','jy_weishop')"></div>
	</div>
</div>
</div>
<div ng-include="sys_html('common/_share','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_menu','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_footer','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_coupon',true)"></div>
<div ng-include="sys_html('common/_sales','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_h5game',true)"></div>
<div ng-include="sys_html('common/_gotop',true)"></div>
<div ng-include="sys_html('common/_welcomehdp',true)"></div>
<!--弹目-->
<div ng-if="pagedata.showtanmus && !pagedata.pluginset.no_tanmu" class="video-sms-pane {{pagedata.transition?'transition':''}}">
		<div class="video-sms-text">
			<image class="video-sms-logo" src="{{pagedata.tanmus[pagedata.nowmsgid].avatar}}"/>
			<span class="overflow-h"> 最新订单来自 {{pagedata.tanmus[pagedata.nowmsgid].nickname}}</span>
		</div>
</div>
<script>
scope.pagedata.setting.issearch=1
scope.pagedata.getarea=function(pcd){
	scope.post_json('jy_pigtuan/index/getarea/',{'pcd':pcd},function(res){
					//console.log(res)
					if(scope.sharedata){
						scope.sharedata.title = res.sharedata.title
						scope.sharedata.link = res.sharedata.link
						scope.sharedata.desc = res.sharedata.desc
						scope.sharedata.imgUrl = res.sharedata.imgUrl
					}
					scope.pagedata.store =res.store;
					scope.tool.get_list('jy_weishop/goods.index/getlist/',true);
					scope.$evalAsync();	
				
	});
}
if((!scope.pagedata.pcd && !scope.pagedata.pcd.city) || !scope.pagedata.area_code){
	window.scope.location(function(re){
		//scope.message(re.addressComponents.district,'error');
		scope.pagedata.getarea(re.addressComponents);
		console.log(re.addressComponents);
	});
}
//手机软键盘--搜索
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});
scope.pagedata.issocketmsg=false;
scope.pagedata.tanmuspage=0;
scope.pagedata.gettanmus=function() {
	if(!scope.pagedata.issocketmsg){
			scope.pagedata.nowmsgid=0;
			scope.get('jy_weishop/get_data/gettanmus/page='+scope.pagedata.tanmuspage,function(res){
						//console.log(res);
						scope.pagedata.tanmus=res.list
						if(scope.pagedata.tanmus.length>0){
							scope.pagedata.tanmuspage++;
							scope.pagedata.up_oldtanmu();
						}
			});
	}
}
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){	
    jinyun_socket.connect(function(res){
			console.log('加入ID为index的组：');console.log(res);
            jinyun_socket.join('index');//加入ID为1的组
     });	 
    jinyun_socket.onsystem=function(res){
        console.log('收到来自后端的消息：');console.log(res);
		scope.pagedata.issocketmsg=true;
		if(scope.pagedata.setting.no_tanmu!=1){
			set_tanmu(res.nickname,res.avatar,res.time);
		}
    }
	//刚进入时；如果没有新订单消息，就弹储备订单消息
	if(scope.pagedata.setting.no_tanmu!=1){
		setTimeout(function(){
			scope.pagedata.gettanmus();
		},2000);
	}
});
scope.pagedata.up_oldtanmu=function() {
		if(scope.page.action=='index'){
			var i=scope.pagedata.nowmsgid;
			if(i<scope.pagedata.tanmus.length){
				set_tanmu(scope.pagedata.tanmus[i].nickname,scope.pagedata.tanmus[i].avatar,scope.pagedata.tanmus[i].time);
			}else{
				scope.pagedata.gettanmus();
			}
		}else{
			return false;
		}
}
function set_tanmu(nickname,avatar,time) {
		scope.pagedata.nowmsgid++
		scope.pagedata.showtanmus=true
		scope.$evalAsync(scope.pagedata.showtanmus);
		setTimeout(function(){
			scope.pagedata.transition=true
			scope.$evalAsync(scope.pagedata.transition);	
		},300);
		setTimeout(function(){
			scope.pagedata.showtanmus=false
			scope.pagedata.transition=false
			scope.$evalAsync(scope.pagedata.showtanmus);	
		},2000);
		setTimeout(function(){
			//等待5秒，如果没有新的订单消息，就弹储备订单消息
			scope.pagedata.issocketmsg=scope.pagedata.issocketmsg?scope.pagedata.issocketmsg:false;
			if(!scope.pagedata.issocketmsg && scope.page.action=='index'){
				scope.pagedata.up_oldtanmu();
			}
		},4000);
}
</script>